<?php

// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------


namespace app\index\controller;

use app\index\BaseController;
use app\index\model\car\CarBrand;
use app\index\model\car\CarModel;
use Exception;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Log;
use think\facade\Request;


/**
 * Class Auth
 * @package app\controller\api
 * @author xaboy
 * @day 2020-05-06
 */
class Car extends BaseController
{
    /**
     * 获取汽车品牌列表
     * @return $this
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    function carBrandList(){
        $getData = $this->request->param();
        $carBrandModel = new CarBrand();
        return $this->success('获取成功',$carBrandModel->getList($getData));
    }

    //汽车型号列表
    function carModelList(){
        $getData = $this->request->param();
        if(!$getData['brand_id']) return $this->fail('请选择车辆品牌');
        $carModelModel = new CarModel();
        $getList = $carModelModel->getList(['brand_id'=>$getData['brand_id']]);
        return $this->success('获取成功',$getList);
    }


}
